<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('使用记录列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>设备名称：</label>
                                <input type="text" name="examinationName" placeholder="请输入要搜索的设备名称"/>
                            </li>
                            <li>
                                <label>操作人：</label>
                                <input type="text" name="userName" placeholder="请输入要搜索的操作人"/>
                            </li>
                            <li>
                                <label>设备型号：</label>
                                <select name="examinationType" th:with="type=${@dict.getType('examination_type')}">
                                    <option value="">请选择要查询的设备型号</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>操作名称：</label>
                                <select name="operationName" th:with="type=${@dict.getType('examination_operation_name')}">
                                    <option value="">请选择要查询的操作名称</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var viewFlag = [[${@permission.hasPermi('use:use:view')}]];
        var examinationTypeDatas = [[${@dict.getType('examination_type')}]];
        var useStatusDatas = [[${@dict.getType('examination_use_status')}]];
        var editFlag = [[${@permission.hasPermi('use:use:edit')}]];
        var removeFlag = [[${@permission.hasPermi('use:use:remove')}]];
        var operationNameDatas = [[${@dict.getType('examination_operation_name')}]];
        var prefix = ctx + "use/use";

        $(function() {
            var options = {
                url: prefix + "/mylist",
                createUrl: prefix + "/add",
                viewUrl: prefix + "/view/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "使用记录",
                columns: [{
                    checkbox: true
                },
                    {
                        field: 'examId',
                        title: '记录编号'
                    },
                    {
                        field: 'examinationName',
                        title: '设备名称'
                    },
                    {
                        field: 'examinationType',
                        title: '设备型号',
                        formatter: function(value, row, index) {
                            return $.table.selectDictLabel(examinationTypeDatas, value);
                        }
                    },
                    {
                        field: 'storeroomName',
                        title: '存放位置'
                    },
                    {
                        field: 'userName',
                        title: '操作人'
                    },
                    {
                        field: 'createTime',
                        title: '操作时间'
                    },
                    {
                        field: 'useStatus',
                        title: '使用状态',
                        formatter: function(value, row, index) {
                            return $.table.selectDictLabel(useStatusDatas, value);
                        }
                    },
                    {
                        field: 'operationName',
                        title: '操作名称',
                        formatter: function(value, row, index) {
                            return $.table.selectDictLabel(operationNameDatas, value);
                        }
                    },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + viewFlag + '" href="javascript:void(0)" onclick="$.operate.view(\'' + row.examId + '\')"><i class="fa fa-search"></i>查看</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.examId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>